package org.xiangxji.snippets.junit;

public class MemoryPool {
    private String name;
    private long init = 0;
    private long max = 0;
    private long used = 0;
    private long committed = 0;
    private String type;
    private String id;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
        this.id = name != null ? name.replaceAll(" ", "_").toLowerCase() : null;
    }

    public long getInit() {
        return init;
    }

    public void setInit(long init) {
        this.init = init;
    }

    public long getMax() {
        return max;
    }

    public void setMax(long max) {
        this.max = max;
    }

    public long getUsed() {
        return used;
    }

    public void setUsed(long used) {
        this.used = used;
    }

    public long getCommitted() {
        return committed;
    }

    public void setCommitted(long committed) {
        this.committed = committed;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public int getUsageScore() {
        return max == 0 ? 0 : (int) (used * 100 / max);
    }

    public String getId() {
        return id;
    }
}
